import _Spin from "choerodon-ui/lib/spin";
import _Popconfirm from "choerodon-ui/lib/popconfirm";
import _Button from "choerodon-ui/pro/lib/button";
import _IntlField from "choerodon-ui/pro/lib/intl-field";
import _Dropdown from "choerodon-ui/pro/lib/dropdown";
import _Icon from "choerodon-ui/lib/icon";
import _Menu from "choerodon-ui/lib/menu";
import _Checkbox from "choerodon-ui/lib/checkbox";
import _Modal from "choerodon-ui/lib/modal";
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
import _DataSet from "choerodon-ui/pro/lib/data-set";
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
import _applyDecoratedDescriptor from "@babel/runtime/helpers/esm/applyDecoratedDescriptor";
import _Table from "choerodon-ui/pro/lib/table";
import _Select from "choerodon-ui/pro/lib/select";
import _isNil from "lodash/isNil";
import _isEmpty from "lodash/isEmpty";

var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _dec19, _dec20, _class;

/* eslint-disable react/state-in-constructor */
import React, { Component } from 'react';
import { Bind, Debounce } from 'lodash-decorators';
import { CPAAS_PLATFORM } from "../../../../utils/config";
import { queryMapIdpValue } from "../../../../services/api";
import notification from "../../../../utils/notification";
import intl from "../../../../utils/intl";
import { queryUserCustConfig, saveUserCustConfig, resetUserCustConfig } from "../withCustomize/customizeTool";
import styles from "./style.less?modules";
var Option = _Select.Option;
var Column = _Table.Column;
var pageSizeOption = [10, 20, 50, 100];
var CustModal = (_dec = Bind(), _dec2 = Bind(), _dec3 = Bind(), _dec4 = Bind(), _dec5 = Bind(), _dec6 = Bind(), _dec7 = Bind(), _dec8 = Bind(), _dec9 = Bind(), _dec10 = Bind(), _dec11 = Bind(), _dec12 = Bind(), _dec13 = Bind(), _dec14 = Bind(), _dec15 = Bind(), _dec16 = Bind(), _dec17 = Debounce(100), _dec18 = Bind(), _dec19 = Bind(), _dec20 = Bind(), (_class = /*#__PURE__*/function (_Component) {
  _inherits(CustModal, _Component);

  var _super = _createSuper(CustModal);

  function CustModal() {
    var _this;

    _classCallCheck(this, CustModal);

    for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
      args[_key] = arguments[_key];
    }

    _this = _super.call.apply(_super, [this].concat(args));
    _this.state = {
      queryLoading: false,
      // 查询接口loading状态标识
      saveLoading: false,
      // 保存接口loading标识
      modifyFlag: false,
      // 是否修改标识
      activeUnitCode: null,
      // 表格列
      tableCols: [],
      pageSize: 10,
      // 表格dataSet配置
      custTableDs: new _DataSet({
        selection: false,
        paging: false
      }),
      modifyConfig: {},
      // 最终配置,用于保存
      dropMenuVisible: true,
      dropMenuMouseEnterFlag: false,
      gridFixedOptions: []
    };
    _this.custColDs = new _DataSet({
      autoCreate: true,
      selection: false,
      paging: false,
      fields: [{
        name: 'fieldName',
        label: intl.get('hcuz.custButton.view.title.columnName').d('列名'),
        type: 'intl',
        required: true
      }, {
        name: 'gridWidth',
        label: intl.get('hcuz.custButton.view.title.columnWidth').d('列宽'),
        type: 'number'
      }, {
        name: 'gridSeq',
        label: intl.get('hcuz.custButton.view.title.position').d('位置'),
        type: 'number'
      }, {
        name: 'gridFixed',
        label: intl.get('hcuz.custButton.view.title.fixed').d('冻结')
      }],
      events: {
        update: function update(_ref) {
          var dataSet = _ref.dataSet,
              name = _ref.name;

          if (!name.includes('_tls')) {
            _this.changeFieldConfig(dataSet.toData());
          }
        }
      },
      transport: {
        tls: function tls(_ref2) {
          var dataSet = _ref2.dataSet,
              fieldName = _ref2.name;

          // TODO: 先使用 dataSet.current 下个版本 c7n 会 把 record 传进来
          var _token = dataSet.current.get('_token');

          return {
            url: "".concat(CPAAS_PLATFORM, "/v1/multi-language"),
            method: 'GET',
            params: {
              _token: _token,
              fieldName: fieldName
            },
            transformResponse: function transformResponse(data) {
              try {
                var jsonData = JSON.parse(data);

                if (jsonData && !jsonData.faied) {
                  var tlsRecord = {};
                  jsonData.forEach(function (intlRecord) {
                    if (!intlRecord.value.trim()) {
                      if (intlRecord.code === 'zh_CN') {
                        tlsRecord[intlRecord.code] = dataSet.current.get('fieldName');
                      } else {
                        // 不要空格，防止错操作
                        tlsRecord[intlRecord.code] = '';
                      }
                    } else {
                      tlsRecord[intlRecord.code] = intlRecord.value;
                    }
                  });
                  return [_defineProperty({}, fieldName, tlsRecord)];
                }
              } catch (e) {// do nothing, use default error deal
              }

              return data;
            }
          };
        }
      }
    });
    return _this;
  }

  _createClass(CustModal, [{
    key: "componentDidMount",
    value: function componentDidMount() {
      this.fetchUserCustConfig();
      this.fetchLovData();
    }
  }, {
    key: "fetchUserCustConfig",
    value: function fetchUserCustConfig() {
      var _this2 = this;

      var activeUnitCode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
      this.setState({
        queryLoading: true
      });
      var _this$props$unit = this.props.unit,
          unit = _this$props$unit === void 0 ? [] : _this$props$unit;

      if (unit && unit.length > 0) {
        queryUserCustConfig({
          unitCode: unit.map(function (item) {
            return item.code;
          }).join(',')
        }).then(function (res) {
          if (res) {
            // 将传入的第一个作为单元设为默认
            _this2.setState({
              activeUnitCode: activeUnitCode || unit[0].code,
              modifyConfig: res || {}
            });

            _this2.initConfig(res[unit[0].code]);
          }

          _this2.setState({
            queryLoading: false
          });
        });
      } else {
        this.setState({
          queryLoading: false
        });
      }
    }
  }, {
    key: "fetchLovData",
    value: function fetchLovData() {
      var _this3 = this;

      queryMapIdpValue({
        gridFixedOptions: 'CPFM.CUST.GIRD.FIXED'
      }).then(function (res) {
        if (res) {
          _this3.setState({
            gridFixedOptions: res.gridFixedOptions || []
          });
        }
      });
    } // 对列排序

  }, {
    key: "sortColumnsOrder",
    value: function sortColumnsOrder() {
      var columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
      var seqField = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'gridSeq';
      var fixedField = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'gridFixed';
      // 按照列顺序字段seqField排序
      columns.sort(function (before, after) {
        return before[seqField] - after[seqField];
      });
      var orderedColumns = columns; // 按照列固定字段gridFixed排序, 左固定前置,右固定后置

      var leftFixedColumns = orderedColumns.filter(function (item) {
        return ['L', 'left'].includes(item[fixedField]);
      });
      var rightFixedColumns = orderedColumns.filter(function (item) {
        return ['R', 'right'].includes(item[fixedField]);
      });
      var centerColumns = orderedColumns.filter(function (item) {
        return !['L', 'left', 'R', 'right'].includes(item[fixedField]);
      });
      orderedColumns = leftFixedColumns.concat(centerColumns).concat(rightFixedColumns);
      return orderedColumns;
    } // 过滤显示列

  }, {
    key: "adjustColumnsVisible",
    value: function adjustColumnsVisible() {
      var columns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
      var _this$props$unit2 = this.props.unit,
          unit = _this$props$unit2 === void 0 ? [] : _this$props$unit2;
      var activeUnitCode = this.state.activeUnitCode;

      if (unit && unit.length > 0) {
        // 初始时设为第一个unit
        if (!activeUnitCode) {
          activeUnitCode = unit[0].code;
        }

        var currentUnit = unit.find(function (item) {
          return item.code === activeUnitCode;
        }) || {};
        var currentUnitColumns = currentUnit.columns || [];
        var newColumns = [];
        columns.forEach(function (item) {
          var newItem = item; // -1 原代码逻辑

          if (item.visible === -1) {
            // 传了原代码的columns
            if (!_isEmpty(currentUnitColumns)) {
              var targetUnitItem = currentUnitColumns.find(function (unitColumnsItem) {
                return unitColumnsItem.name === item.fieldCode;
              });

              if (targetUnitItem) {
                newItem.visible = targetUnitItem.hidden ? 0 : 1;
              }
            } else {
              // 未传原代码的columns
              newItem.visible = 1;
            }
          }

          newColumns.push(newItem);
        });
        return newColumns;
      }

      return columns;
    }
  }, {
    key: "initConfig",
    value: function initConfig() {
      var custConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var _custConfig$config = custConfig.config,
          config = _custConfig$config === void 0 ? {} : _custConfig$config;
      var fields = custConfig.fields;
      var btnDisabled;
      var newPageSize = 10;

      if (!fields) {
        fields = [];
        btnDisabled = true;
      }

      if (_isEmpty(config)) {
        btnDisabled = true;
      } else {
        newPageSize = config.pageSize;
      }

      var custTableDsFields = [];
      fields = this.sortColumnsOrder(fields);
      fields = this.adjustColumnsVisible(fields);
      var tableCols = fields.map(function (item) {
        custTableDsFields.push({
          name: item.fieldCode,
          label: item.fieldName
        });
        var lock = null;

        if (item.gridFixed === 'L') {
          lock = 'left';
        }

        if (item.gridFixed === 'R') {
          lock = 'right';
        }

        return {
          name: item.fieldCode,
          label: item.fieldName,
          width: item.gridWidth,
          orderSeq: item.gridSeq,
          hidden: item.visible === 0,
          lock: lock
        };
      });
      this.custColDs.loadData(fields.filter(function (item) {
        return item.visible === 1;
      }));
      this.setState({
        btnDisabled: btnDisabled,
        pageSize: newPageSize,
        tableCols: tableCols,
        custTableDs: new _DataSet({
          selection: false,
          paging: false,
          fields: custTableDsFields
        })
      });
    }
  }, {
    key: "changeUnit",
    value: function changeUnit(unitCode) {
      var _this4 = this;

      var _this$state = this.state,
          activeUnitCode = _this$state.activeUnitCode,
          modifyConfig = _this$state.modifyConfig,
          _this$state$modifyFla = _this$state.modifyFlag,
          modifyFlag = _this$state$modifyFla === void 0 ? false : _this$state$modifyFla;

      if (activeUnitCode !== unitCode) {
        if (modifyFlag) {
          _Modal.confirm({
            content: intl.get('hcuz.custButton.view.message.delete.confirm').d('此页面有修改项尚未保存，确定要离开此页面？'),
            okText: intl.get('cpaas.common.button.sure').d('确定'),
            cancelText: intl.get('cpaas.common.button.cancel').d('取消'),
            onOk: function onOk() {
              _this4.setState({
                activeUnitCode: unitCode,
                modifyFlag: false
              });

              _this4.initConfig(modifyConfig[unitCode]);
            }
          });
        } else {
          this.setState({
            activeUnitCode: unitCode,
            modifyFlag: false
          });
          this.initConfig(modifyConfig[unitCode]);
        }
      }
    } // 更改字段配置

  }, {
    key: "changeFieldConfig",
    value: function changeFieldConfig(config) {
      var _this$state2 = this.state,
          modifyConfig = _this$state2.modifyConfig,
          activeUnitCode = _this$state2.activeUnitCode;
      var fields = modifyConfig[activeUnitCode].fields || [];
      var newFields = fields.map(function (fieldItem) {
        var newItem = config.find(function (configItem) {
          return configItem.fieldCode === fieldItem.fieldCode;
        });

        if (newItem) {
          return newItem;
        }

        return fieldItem;
      });
      modifyConfig[activeUnitCode].fields = newFields;
      this.setState({
        modifyConfig: modifyConfig,
        modifyFlag: true
      });
      this.initConfig(modifyConfig[activeUnitCode]);
    } // 更改字段显示隐藏, 固定模式

  }, {
    key: "changeFieldVisibleOrFixed",
    value: function changeFieldVisibleOrFixed(fieldCode, attribute) {
      var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
      var _this$state3 = this.state,
          modifyConfig = _this$state3.modifyConfig,
          activeUnitCode = _this$state3.activeUnitCode;
      var fields = modifyConfig[activeUnitCode].fields || []; // eslint-disable-next-line array-callback-return

      fields.find(function (fieldItem) {
        if (fieldItem.fieldCode === fieldCode) {
          if (attribute === 'visible') {
            // eslint-disable-next-line no-param-reassign
            fieldItem.visible = fieldItem.visible === 0 ? 1 : 0;
          } else {
            // eslint-disable-next-line no-param-reassign
            fieldItem[attribute] = value;
          }
        }
      });
      modifyConfig[activeUnitCode].fields = fields;
      this.setState({
        modifyConfig: modifyConfig,
        modifyFlag: true
      });
      this.initConfig(modifyConfig[activeUnitCode]);
    } // 解决bug: 取消时 c7n IntlField 会默认改变index=0的record

  }, {
    key: "cancleChangeIntl",
    value: function cancleChangeIntl() {
      var _this$state4 = this.state,
          modifyConfig = _this$state4.modifyConfig,
          activeUnitCode = _this$state4.activeUnitCode;
      this.initConfig(modifyConfig[activeUnitCode]);
    }
  }, {
    key: "changeIntl",
    value: function changeIntl() {
      this.changeFieldConfig(this.custColDs.toData());
    } // 更改表格每页行数

  }, {
    key: "changePageSize",
    value: function changePageSize(pageSize) {
      var _this$state5 = this.state,
          activeUnitCode = _this$state5.activeUnitCode,
          _this$state5$modifyCo = _this$state5.modifyConfig,
          modifyConfig = _this$state5$modifyCo === void 0 ? {} : _this$state5$modifyCo;
      modifyConfig[activeUnitCode].config.pageSize = pageSize;
      this.setState({
        modifyConfig: modifyConfig,
        pageSize: pageSize,
        modifyFlag: true
      });
    } // 渲染左侧单元

  }, {
    key: "renderUnit",
    value: function renderUnit() {
      var _this5 = this;

      var _this$state6 = this.state,
          activeUnitCode = _this$state6.activeUnitCode,
          modifyConfig = _this$state6.modifyConfig;
      return Object.keys(modifyConfig).map(function (item) {
        return /*#__PURE__*/React.createElement("div", {
          className: activeUnitCode === item ? styles['cust-unit-active'] : styles['cust-unit'],
          onClick: function onClick() {
            return _this5.changeUnit(item);
          }
        }, /*#__PURE__*/React.createElement("div", {
          className: styles['cust-unit-name']
        }, modifyConfig[item].unitName), /*#__PURE__*/React.createElement("div", {
          className: styles['cust-unit-code']
        }, item));
      });
    } // 还原

  }, {
    key: "reset",
    value: function reset() {
      var _this6 = this;

      var _this$state7 = this.state,
          _this$state7$modifyCo = _this$state7.modifyConfig,
          modifyConfig = _this$state7$modifyCo === void 0 ? {} : _this$state7$modifyCo,
          activeUnitCode = _this$state7.activeUnitCode;
      var _modifyConfig$activeU = modifyConfig[activeUnitCode].config,
          config = _modifyConfig$activeU === void 0 ? {} : _modifyConfig$activeU;
      this.setState({
        resetLoading: true
      });

      if (!_isEmpty(config)) {
        resetUserCustConfig({
          unitId: config.unitId
        }).then(function (res) {
          if (!_isNil(res)) {
            notification.success();

            _this6.fetchUserCustConfig(activeUnitCode);
          }

          _this6.setState({
            resetLoading: false
          });
        });
      }
    } // 保存

  }, {
    key: "save",
    value: function save() {
      var _this7 = this;

      var _this$state8 = this.state,
          modifyConfig = _this$state8.modifyConfig,
          activeUnitCode = _this$state8.activeUnitCode;
      this.custColDs.validate().then(function (resp) {
        if (resp) {
          var fields = modifyConfig[activeUnitCode].fields || [];
          var newFields = [];

          if (fields.length > 0) {
            newFields = fields.map(function (fieldItem) {
              if (fieldItem._tls && fieldItem._tls.fieldName && !fieldItem._tls.fieldName.zh_CN) {
                // eslint-disable-next-line no-param-reassign
                fieldItem._tls.fieldName.zh_CN = fieldItem.fieldName;
              }

              return fieldItem;
            });
          }

          modifyConfig[activeUnitCode].fields = newFields;
          var params = modifyConfig[activeUnitCode];

          _this7.setState({
            saveLoading: true
          });

          saveUserCustConfig(params).then(function (res) {
            if (res) {
              notification.success();
              var _this7$props$handleCl = _this7.props.handleClose,
                  handleClose = _this7$props$handleCl === void 0 ? function () {} : _this7$props$handleCl;
              handleClose();
            }

            _this7.setState({
              saveLoading: false
            });
          });
        }
      });
    } // 取消

  }, {
    key: "cancle",
    value: function cancle() {
      var _this$props$handleClo = this.props.handleClose,
          handleClose = _this$props$handleClo === void 0 ? function () {} : _this$props$handleClo;
      handleClose();
    }
  }, {
    key: "toggleDropMenu",
    value: function toggleDropMenu() {
      this.setState({
        dropMenuVisible: false
      });
    }
  }, {
    key: "hiddenDropMenu",
    value: function hiddenDropMenu() {
      var dropMenuMouseEnterFlag = this.state.dropMenuMouseEnterFlag; // 防抖

      if (!dropMenuMouseEnterFlag) {
        this.setState({
          dropMenuVisible: true
        });
      }
    }
  }, {
    key: "toggleMouseEnterFlag",
    value: function toggleMouseEnterFlag() {
      this.setState({
        dropMenuMouseEnterFlag: true
      });
    }
  }, {
    key: "clearMouseEnterFlag",
    value: function clearMouseEnterFlag() {
      this.setState({
        dropMenuMouseEnterFlag: true,
        dropMenuVisible: true
      });
    }
  }, {
    key: "render",
    value: function render() {
      var _this8 = this;

      var _this$state9 = this.state,
          dropMenuVisible = _this$state9.dropMenuVisible,
          custTableDs = _this$state9.custTableDs,
          _this$state9$pageSize = _this$state9.pageSize,
          pageSize = _this$state9$pageSize === void 0 ? 10 : _this$state9$pageSize,
          _this$state9$queryLoa = _this$state9.queryLoading,
          queryLoading = _this$state9$queryLoa === void 0 ? false : _this$state9$queryLoa,
          _this$state9$saveLoad = _this$state9.saveLoading,
          saveLoading = _this$state9$saveLoad === void 0 ? false : _this$state9$saveLoad,
          _this$state9$resetLoa = _this$state9.resetLoading,
          resetLoading = _this$state9$resetLoa === void 0 ? false : _this$state9$resetLoa,
          _this$state9$tableCol = _this$state9.tableCols,
          tableCols = _this$state9$tableCol === void 0 ? [] : _this$state9$tableCol,
          _this$state9$gridFixe = _this$state9.gridFixedOptions,
          gridFixedOptions = _this$state9$gridFixe === void 0 ? [] : _this$state9$gridFixe,
          _this$state9$btnDisab = _this$state9.btnDisabled,
          btnDisabled = _this$state9$btnDisab === void 0 ? false : _this$state9$btnDisab;
      var menu = /*#__PURE__*/React.createElement(_Menu, {
        className: styles['cust-col-dropDown-menu'],
        onMouseEnter: this.toggleMouseEnterFlag,
        onMouseLeave: this.clearMouseEnterFlag
      }, tableCols.map(function (item) {
        return /*#__PURE__*/React.createElement(_Menu.Item, {
          onClick: function onClick() {
            return _this8.changeFieldVisibleOrFixed(item.name, 'visible');
          },
          className: styles['cust-col-dropDown-menu-item']
        }, /*#__PURE__*/React.createElement(_Checkbox, {
          checked: !item.hidden
        }), " ", item.label);
      }));
      return /*#__PURE__*/React.createElement(_Spin, {
        spinning: queryLoading || saveLoading || resetLoading
      }, /*#__PURE__*/React.createElement("div", {
        className: styles['modal-content']
      }, /*#__PURE__*/React.createElement("div", {
        className: styles['modal-content-left']
      }, /*#__PURE__*/React.createElement("header", {
        className: styles['modal-content-left-title']
      }, intl.get('hcuz.custButton.view.title.individuationTableUnit').d('个性化表格单元')), this.renderUnit()), /*#__PURE__*/React.createElement("div", {
        className: styles['modal-content-right']
      }, /*#__PURE__*/React.createElement("div", {
        className: styles['cust-preview']
      }, intl.get('hcuz.custButton.view.title.preview').d('预览效果')), /*#__PURE__*/React.createElement("div", {
        className: styles['cust-preview-table']
      }, /*#__PURE__*/React.createElement(_Table, {
        dataSet: custTableDs,
        pagination: false,
        columns: tableCols
      })), /*#__PURE__*/React.createElement("div", {
        className: styles['cust-field']
      }, intl.get('hcuz.custButton.view.title.field').d('字段'), /*#__PURE__*/React.createElement("div", {
        className: styles['cust-col-dropDown-div']
      }, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("span", {
        className: styles['cust-col-dropDown-div-title']
      }, intl.get('hcuz.custButton.view.title.pageSize').d('每页行数'), ":"), /*#__PURE__*/React.createElement(_Select, {
        className: styles['cust-col-dropDown-div-select'],
        value: pageSize,
        onChange: this.changePageSize
      }, pageSizeOption.map(function (item) {
        return /*#__PURE__*/React.createElement(Option, {
          key: item,
          value: item
        }, item);
      })), /*#__PURE__*/React.createElement(_Dropdown, {
        className: styles['cust-col-dropDown'],
        overlay: menu,
        placement: "bottomRight",
        hidden: dropMenuVisible
      }, /*#__PURE__*/React.createElement("span", {
        className: styles['cust-col-dropDown-div-title']
      }, intl.get('hcuz.custButton.view.title.tableCol').d('表格字段'), ":"), /*#__PURE__*/React.createElement(_Icon, {
        type: "view_column",
        onMouseEnter: this.toggleDropMenu,
        onMouseLeave: this.hiddenDropMenu,
        style: {
          marginLeft: 3
        }
      }))))), /*#__PURE__*/React.createElement(_Table, {
        className: styles['cust-col-table'],
        pagination: false,
        dataSet: this.custColDs
      }, /*#__PURE__*/React.createElement(Column, {
        name: "fieldName",
        resizable: false,
        editor: /*#__PURE__*/React.createElement(_IntlField, {
          modalProps: {
            onCancel: this.cancleChangeIntl,
            onOk: this.changeIntl
          }
        })
      }), /*#__PURE__*/React.createElement(Column, {
        name: "gridSeq",
        editor: true,
        resizable: false,
        width: 150
      }), /*#__PURE__*/React.createElement(Column, {
        name: "gridWidth",
        editor: true,
        resizable: false,
        width: 150
      }), /*#__PURE__*/React.createElement(Column, {
        resizable: false,
        name: "gridFixed",
        width: 150,
        renderer: function renderer(_ref4) {
          var value = _ref4.value,
              record = _ref4.record;
          return /*#__PURE__*/React.createElement(_Select, {
            value: value,
            onChange: function onChange(val) {
              return _this8.changeFieldVisibleOrFixed(record.get('fieldCode'), 'gridFixed', val);
            }
          }, gridFixedOptions.map(function (firxedItem) {
            return /*#__PURE__*/React.createElement(Option, {
              value: firxedItem.value
            }, firxedItem.meaning);
          }));
        }
      })))), /*#__PURE__*/React.createElement("div", {
        className: styles['modal-footer']
      }, /*#__PURE__*/React.createElement(_Button, {
        icon: "cancel",
        onClick: this.cancle,
        disabled: saveLoading || resetLoading
      }, intl.get('cpaas.common.button.cancel').d('取消')), /*#__PURE__*/React.createElement(_Popconfirm, {
        title: intl.get('hcuz.custButton.view.button.confirmRestore').d('是否确认还原？'),
        onConfirm: this.reset,
        okText: intl.get('cpaas.common.status.yes').d('是'),
        cancelText: intl.get('cpaas.common.status.no').d('否')
      }, /*#__PURE__*/React.createElement(_Button, {
        icon: "refresh",
        loading: resetLoading,
        disabled: btnDisabled || saveLoading
      }, intl.get('hcuz.custButton.view.button.restore').d('还原'))), /*#__PURE__*/React.createElement(_Button, {
        icon: "save",
        color: "primary",
        onClick: this.save,
        loading: saveLoading,
        disabled: btnDisabled || resetLoading
      }, intl.get('cpaas.common.button.save').d('保存'))));
    }
  }]);

  return CustModal;
}(Component), (_applyDecoratedDescriptor(_class.prototype, "fetchUserCustConfig", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "fetchUserCustConfig"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "fetchLovData", [_dec2], Object.getOwnPropertyDescriptor(_class.prototype, "fetchLovData"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "sortColumnsOrder", [_dec3], Object.getOwnPropertyDescriptor(_class.prototype, "sortColumnsOrder"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "adjustColumnsVisible", [_dec4], Object.getOwnPropertyDescriptor(_class.prototype, "adjustColumnsVisible"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "initConfig", [_dec5], Object.getOwnPropertyDescriptor(_class.prototype, "initConfig"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "changeUnit", [_dec6], Object.getOwnPropertyDescriptor(_class.prototype, "changeUnit"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "changeFieldConfig", [_dec7], Object.getOwnPropertyDescriptor(_class.prototype, "changeFieldConfig"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "changeFieldVisibleOrFixed", [_dec8], Object.getOwnPropertyDescriptor(_class.prototype, "changeFieldVisibleOrFixed"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "cancleChangeIntl", [_dec9], Object.getOwnPropertyDescriptor(_class.prototype, "cancleChangeIntl"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "changeIntl", [_dec10], Object.getOwnPropertyDescriptor(_class.prototype, "changeIntl"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "changePageSize", [_dec11], Object.getOwnPropertyDescriptor(_class.prototype, "changePageSize"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "renderUnit", [_dec12], Object.getOwnPropertyDescriptor(_class.prototype, "renderUnit"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "reset", [_dec13], Object.getOwnPropertyDescriptor(_class.prototype, "reset"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "save", [_dec14], Object.getOwnPropertyDescriptor(_class.prototype, "save"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "cancle", [_dec15], Object.getOwnPropertyDescriptor(_class.prototype, "cancle"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "toggleDropMenu", [_dec16], Object.getOwnPropertyDescriptor(_class.prototype, "toggleDropMenu"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "hiddenDropMenu", [_dec17, _dec18], Object.getOwnPropertyDescriptor(_class.prototype, "hiddenDropMenu"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "toggleMouseEnterFlag", [_dec19], Object.getOwnPropertyDescriptor(_class.prototype, "toggleMouseEnterFlag"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "clearMouseEnterFlag", [_dec20], Object.getOwnPropertyDescriptor(_class.prototype, "clearMouseEnterFlag"), _class.prototype)), _class));
export { CustModal as default };